import React, { useEffect, useState } from 'react'
import axios from 'axios'

const Login:React.FC = ()=>{
  const [data,setData] = useState<string>('');
  useEffect(()=>{
    axios.get('http://localhost:3000/getData')
    .then(response => setData(response.data.data))
    .catch(error => console.log(error))
  },[])
  return (
    <div>
      <h1>react+Express 全栈应用</h1>
      <p>后端数据：{data}</p>
    </div>
  )
}

export default Login
